module top_module (
    input clk,
    input slowena,
    input reset,
    output [3:0] q);

    always @(posedge clk) begin
        if(reset) begin
            q <= 0;
        end
        else if(slowena) begin
            q <= (q == 9) ? 0 : (q + 1);
        end
    end

    // reg [3:0] cnt;
    // //period is 10 
    // //What is supposed to happen when the counter is 9 and not enabled?
    // always @ (posedge clk)
    //     begin
    //         if(reset)
    //             cnt <= 4'b0;
    //         else if(slowena == 1'b1)
    //             //slowena 为高，计数器才能正常运行
    //             begin
    //                 if(cnt == 4'd9)
    //                     cnt <= 4'b0;
    //                 //因为题目要求周期为10，所以0～9之后下一个为0；
    //                 else 
    //                     cnt <= cnt + 4'd1;
    //             end
    //     end

    // assign q = cnt;

endmodule
